using System;
using System.Diagnostics;
using VirtualKeyboard.Contract;

namespace VirtualKeyboard.Service.Commands
{
    public sealed class MediaCommand : ICommand
    {
        private readonly IKeyBoardHook keyBoardHook;

        public MediaCommand(IKeyBoardHook keyBoardHook)
        {
            this.keyBoardHook = keyBoardHook;
        }

        public string Package
        {
            get { return KeyMethods.MediaPackage; }
        }

        public void Press(string method)
        {
            string shortcutKey = MediaMethodConfig.Instance.Parse(method);
            if (string.IsNullOrEmpty(shortcutKey))return;
            Debug.Print("Press {0}", shortcutKey);
            Keys[] keys = ShortcutKeyConvert.Convert(shortcutKey);
            keyBoardHook.PressKey(keys);
        }
    }
}